using System.Data.Entity.ModelConfiguration;

namespace OBUCare.Core.Models.Mapping
{
    public class View_Invoice_InfoMap : EntityTypeConfiguration<View_Invoice_Info>
    {
        public View_Invoice_InfoMap()
        {
            // Primary Key
            this.HasKey(t => new { t.SERIAL_NO, t.USER_NO, t.INVOICE_TYPE, t.AMOUNT, t.INCOICE_TIME, t.OPERATOR_NO, t.AGENT_NO, t.STATUS });

            // Properties
            this.Property(t => t.SERIAL_NO)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.USER_NO)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(16);

            this.Property(t => t.USERNAME)
                .HasMaxLength(120);

            this.Property(t => t.INVOICE_NO)
                .HasMaxLength(50);

            

            this.Property(t => t.InvoiceType_Title)
                .HasMaxLength(50);

           

            this.Property(t => t.OPERATOR_NO)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.OPERATOR_NAME)
                .HasMaxLength(50);

            this.Property(t => t.AGENT_NO)
                .IsRequired()
                .HasMaxLength(12);

            this.Property(t => t.AGENT_NAME)
                .HasMaxLength(50);

            this.Property(t => t.AGENT_TYPE_NO)
                .IsFixedLength()
                .HasMaxLength(2);

            

            // Table & Column Mappings
            this.ToTable("View_Invoice_Info");
            this.Property(t => t.SERIAL_NO).HasColumnName("SERIAL_NO");
            this.Property(t => t.USER_NO).HasColumnName("USER_NO");
            this.Property(t => t.USERNAME).HasColumnName("USERNAME");
            this.Property(t => t.INVOICE_NO).HasColumnName("INVOICE_NO");
            this.Property(t => t.INVOICE_TYPE).HasColumnName("INVOICE_TYPE");
            this.Property(t => t.InvoiceType_Title).HasColumnName("InvoiceType_Title");
            this.Property(t => t.AMOUNT).HasColumnName("AMOUNT");
            this.Property(t => t.INCOICE_TIME).HasColumnName("INCOICE_TIME");
            this.Property(t => t.OPERATOR_NO).HasColumnName("OPERATOR_NO");
            this.Property(t => t.OPERATOR_NAME).HasColumnName("OPERATOR_NAME");
            this.Property(t => t.AGENT_NO).HasColumnName("AGENT_NO");
            this.Property(t => t.AGENT_NAME).HasColumnName("AGENT_NAME");
            this.Property(t => t.AGENT_TYPE_NO).HasColumnName("AGENT_TYPE_NO");
            this.Property(t => t.STATUS).HasColumnName("STATUS");
        }
    }
}
